/* GUI CONVERTED from bmwurpa.p (converter v1.76) Tue Jun  4 05:16:54 2002 */
/* bmwurpa.p - WHERE-USED REPORT                                              */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.6.1.9 $                                                       */
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 1.0      LAST EDIT:     06/03/86   BY: EMB                       */
/* REVISION: 1.0      LAST EDIT:     08/29/86   BY: EMB *12*                  */
/* REVISION: 2.1      LAST EDIT:     10/19/87   BY: WUG *A94*                 */
/* REVISION: 4.0      LAST EDIT:     01/05/88   BY: RL  *A118*                */
/* REVISION: 4.0      LAST EDIT:     01/06/88   BY: RL  *A122*                */
/* REVISION: 4.0      LAST EDIT:     02/16/88   BY: FLM *A175*                */
/* REVISION: 6.0      LAST EDIT:     10/30/90   BY: emb *D145*                */
/* REVISION: 7.0      LAST EDIT:     01/02/92   BY: emb                       */
/* REVISION: 7.2      LAST MODIFIED: 11/02/92   BY: pma *G265*                */
/* REVISION: 7.3      LAST MODIFIED: 12/20/93   BY: ais *GH69*                */
/* REVISION: 8.6      LAST MODIFIED: 09/27/97   BY: mzv *K0J *                */
/* REVISION: 8.6      LAST MODIFIED: 10/15/97   BY: ays *K106*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.0      LAST MODIFIED: 07/30/99   BY: *J3J4* Jyoti Thatte       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 07/07/00   BY: *L10Y* Vandna Rohira      */
/* REVISION: 9.1      LAST MODIFIED: 08/11/00   BY: *N0KK* jyn                */
/* REVISION: 9.1      LAST MODIFIED: 08/21/00   BY: *N0MG* BalbeerS Rajput    */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.6.1.9 $   BY: Jean Miller        DATE: 05/25/02  ECO: *P076*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define shared variable transtype as character format "x(4)".

define variable comp like ps_comp.
define variable level as integer.
define variable maxlevel as integer format ">>>" label "Levels".

define variable eff_date as date label "As of Date".
define variable component like ps_comp.
define variable component1 like ps_comp.
define variable component2 like ps_comp.
define variable skpge like mfc_logical label "New Page each Component".

define variable desc1 like pt_desc1 format "x(80)".
define variable um like pt_um.
define variable phantom like mfc_logical format "yes" label "Ph".
define variable iss_pol like pt_iss_pol format "/no".
define variable record as integer extent 1000.
define variable lvl as character format "x(11)" label "Level".
define variable temp_comp like ps_comp.
define variable bombatch like bom_batch.
define variable down1 as character.
define variable line2 like ps_par format "x(24)".

define variable l_level   as integer initial 0 no-undo.
define variable l_psrecid as recid no-undo.
define variable l_next    like mfc_logical initial yes no-undo.
define variable l_nextptp like mfc_logical initial no  no-undo.


eff_date = today.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
   component1     colon 20
   component2     label "To"
   skip(1)
   eff_date       colon 25
   maxlevel       colon 25
   skpge          colon 25
 SKIP(.4)  /*GUI*/
with frame a width 80 side-labels NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{wbrp02.i}


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


   if component2 = hi_char then component2 = "".

   if c-application-mode <> 'web' then
      
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update &fields = " component1 component2
        eff_date maxlevel skpge " &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data')) then do:

      bcdparm = "".
      {mfquoter.i component1 }
      {mfquoter.i component2 }
      {mfquoter.i eff_date   }
      {mfquoter.i maxlevel   }
      {mfquoter.i skpge      }

      if component2 = "" then component2 = hi_char.
   end.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:

define buffer ptmstr for pt_mstr.
define buffer ptmstr1 for pt_mstr.
define buffer psmstr  for ps_mstr.


   {mfphead.i}

   maxlevel = min(maxlevel,99).

   /*DETAIL FORM (BM)*/
   FORM /*GUI*/ 
      lvl
      ps_par
      ps_ref
      desc1
      ps_qty_per
      um
      phantom
      ps_ps_code
      iss_pol
      ps_start
      ps_end
      ps_scrp_pct
      ps_lt_off
   with STREAM-IO /*GUI*/  frame bm width 200 no-attr-space down.

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame bm:handle).

   /*DETAIL FORM (FM)*/
   FORM /*GUI*/ 
      lvl
      ps_par
      ps_ref
      ps_qty_per_b
      ps_qty_type
      bombatch
      um
      phantom
      ps_ps_code
      iss_pol
      ps_start
      ps_end
      ps_scrp_pct
      ps_lt_off
   with STREAM-IO /*GUI*/  frame fm width 132 no-attr-space down.

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame fm:handle).

   temp_comp = "".

   for first ps_mstr
      fields(ps_comp     ps_end     ps_lt_off    ps_par
             ps_ps_code  ps_qty_per ps_qty_per_b
             ps_qty_type ps_ref     ps_scrp_pct  ps_start)
      where ps_mstr.ps_comp >= max(temp_comp,component1)
      and ps_mstr.ps_comp <= component2
   no-lock: end.

   down1 = "X".
   repeat:

      if not available ps_mstr then leave.

      assign
         comp = ps_comp
         level = 1
         temp_comp = ps_comp
         component = ps_comp
         desc1 = getTermLabel("ITEM_NOT_IN_INVENTORY",24)
         um = ""
         iss_pol = no
         phantom = no.

      find pt_mstr no-lock where pt_part = ps_comp no-error.

      if available pt_mstr then do:
         assign
            um = pt_um
            desc1 = pt_desc1 + pt_desc2  /*zyf1119*/
            iss_pol = pt_iss_pol
            phantom = pt_phantom.
      end.

      find bom_mstr no-lock where bom_parent = ps_comp no-error.

      if available bom_mstr then do:

         if desc1 = getTermLabel("ITEM_NOT_IN_INVENTORY",24) then
            desc1 = bom_desc.

         if um = "" then um = bom_batch_um.
         if transtype = "FM" then do:
            if bom_batch <> 0 then
               bombatch = bom_batch.
            else
               bombatch = 1.
            um = bom_batch_um.
         end.
      end.

      if page-size - line-counter < 4 then do:
         down1 = "X".
         page.
      end.

      /* START DISPLAY */
      line2 = "".

      if available pt_mstr then line2 = "" /*zyf1119 pt_desc2*/.

      if transtype = "BM" then do:
         {bmwurpa1.i &frame="bm"
            &down=down1
            &level="getTermLabel(""COMPONENT"",11) @ lvl"
            &comp="component @ ps_par"
            &desc1=desc1
            &um=um
            &phantom=phantom
            &isspol=iss_pol
            &line1=""""
            &line2=line2
            &line3=""""}
      end.

      else do:
         {bmwurpa1.i &frame="fm"
            &down=down1
            &level="getTermLabel(""COMPONENT"",11) @ lvl"
            &comp="component @ ps_par"
            &batch=bombatch
            &um=um
            &phantom=phantom
            &isspol=iss_pol
            &line1=desc1
            &line2=line2
            &line3=""""}
      end.

      down1 = "".

      repeat:

         if not available ps_mstr then do:
            repeat:
               level = level - 1.
               if level < 1 then leave.
               find ps_mstr where recid(ps_mstr) = record[level]
               no-lock no-error.
               comp = ps_comp.
               find next ps_mstr use-index ps_comp
                  where ps_mstr.ps_comp = comp
               no-lock no-error.
               if available ps_mstr then leave.
            end.
         end.

         if level < 1 then leave.

         if eff_date = ? or (eff_date <> ?
            and (ps_start = ? or ps_start <= eff_date)
            and (ps_end = ? or eff_date <= ps_end))
         then do:

            desc1 = getTermLabel("ITEM_NOT_IN_INVENTORY",24).
            um = "".
            iss_pol = no.
            phantom = no.

            find ptmstr where ptmstr.pt_part = ps_par
            no-lock no-error.

            if available ptmstr then do:
               assign
                  um = ptmstr.pt_um
                  desc1 = ptmstr.pt_desc1 + ptmstr.pt_desc2  /*zyf1119*/
                  iss_pol = ptmstr.pt_iss_pol
                  phantom = ptmstr.pt_phantom.
            end.

            find bom_mstr no-lock where bom_parent = ps_par no-error.
            if available bom_mstr then do:
               if desc1 = getTermLabel("ITEM_NOT_IN_INVENTORY",24)
                  then desc1 = bom_desc.
               if um = "" then um = bom_batch_um.
               if transtype = "FM" then do:
                  if bom_batch <> 0 then
                     bombatch = bom_batch.
                  else
                     bombatch = 1.
                  um = bom_batch_um.
               end.
            end.

            record[level] = recid(ps_mstr).

            lvl = "........".
            lvl = substring(lvl,1,min (level - 1,10)) + string(level).
            if length(lvl) > 11 then
               lvl = substring(lvl,length (lvl) - 10,11).

            if page-size - line-counter < 2 then page.

            line2 = "".
            if available ptmstr then line2 = "" . /*zyf1119 ptmstr.pt_desc2.*/

            if transtype = "BM" then do:
               {bmwurpa1.i &frame="bm"
                  &down=""X""
                  &level=lvl
                  &comp=ps_par
                  &ref=ps_ref
                  &desc1=desc1
                  &qtyper=ps_qty_per
                  &um=um
                  &phantom=phantom
                  &pscode=ps_ps_code
                  &isspol=iss_pol
                  &start=ps_start
                  &end=ps_end
                  &scrap=ps_scrp_pct
                  &offset=ps_lt_off
                  &line1=""""
                  &line2=line2
                  &line3=ps_rmks}
            end.

            else do:
               {bmwurpa1.i &frame="fm"
                  &down=""X""
                  &level=lvl
                  &comp=ps_par
                  &ref=ps_ref
                  &qtyper=ps_qty_per_b
                  &qtytype=ps_qty_type
                  &batch=bombatch
                  &um=um
                  &phantom=phantom
                  &pscode=ps_ps_code
                  &isspol=iss_pol
                  &start=ps_start
                  &end=ps_end
                  &scrap=ps_scrp_pct
                  &offset=ps_lt_off
                  &line1=desc1
                  &line2=line2
                  &line3=ps_rmks}
            end.

            if level < maxlevel or maxlevel = 0 then do:

               comp = ps_par.
               level = level + 1.

               for first ps_mstr
                  fields(ps_comp     ps_end     ps_lt_off    ps_par
                         ps_ps_code  ps_qty_per ps_qty_per_b
                         ps_qty_type ps_ref     ps_scrp_pct  ps_start)
                  use-index ps_comp
                  where ps_mstr.ps_comp = comp
               no-lock: end.

               /* IF THE PRODUCT STRUCTURE RECORD IS NOT AVAILABLE THEN THIS  */
               /* PROCEDURE EXPLODES FURTHER USING THE PTP_DET AND PT-MSTR    */
               /* BY VERIFYING IF THE COMPONENT EXISTS AS A BOM CODE FOR ANY  */
               /* OTHER ITEMS.                                                */
               if not available ps_mstr then do:

                  if l_next = yes then do:
                     for first ptp_det
                        fields(ptp_bom_code ptp_part)
                        where ptp_det.ptp_bom_code = comp
                     no-lock: end.

                     if available ptp_det then do:
                        l_nextptp = yes.
                        for first ptmstr1
                           fields(pt_bom_code pt_desc1 pt_desc2
                           pt_iss_pol pt_part pt_phantom)
                           where  ptmstr1.pt_part = ptp_part
                        no-lock: end.
                     end. /* IF AVAILABLE PTP_DET */

                     else
                     for first ptmstr1
                        fields(pt_bom_code pt_desc1 pt_desc2
                        pt_iss_pol pt_part pt_phantom)
                        where ptmstr1.pt_bom_code = comp
                     no-lock: end.

                     for first psmstr
                        fields(ps_comp ps_end ps_lt_off ps_par
                        ps_ps_code ps_qty_per ps_qty_per_b
                        ps_qty_type ps_ref ps_scrp_pct ps_start)
                        where psmstr.ps_par = comp
                     no-lock : end.

                     if available psmstr then
                     assign
                        l_psrecid = recid(psmstr)
                        l_level   = level.

                  end. /* L_NEXT = YES */

                  else do:

                     for first psmstr
                        fields(ps_comp ps_end ps_lt_off ps_par
                               ps_ps_code ps_qty_per ps_qty_per_b
                               ps_qty_type ps_ref ps_scrp_pct ps_start)
                        where recid(psmstr) = l_psrecid
                     no-lock : end.

                     find next ptp_det
                        where ptp_det.ptp_bom_code = psmstr.ps_par
                     no-lock no-error.

                     if available ptp_det then do:
                        for first ptmstr1
                           fields(pt_bom_code pt_desc1 pt_desc2
                                  pt_iss_pol pt_part pt_phantom)
                           where ptmstr1.pt_part = ptp_part
                        no-lock: end.
                     end. /* IF AVAIL PTP_DET */

                     else do:

                        if l_nextptp = yes then do:
                           for first ptmstr1
                              fields(pt_bom_code pt_desc1 pt_desc2
                                     pt_iss_pol pt_part pt_phantom)
                              where ptmstr1.pt_bom_code = psmstr.ps_par
                           no-lock: end.
                           l_nextptp = no.
                        end. /* IF L_NEXTPTP = YES */

                        else do:
                           find next ptmstr1
                              where ptmstr1.pt_bom_code = psmstr.ps_par
                              and not(can-find (first ptp_det
                              where ptp_part = ptmstr1.pt_part and
                              ptp_bom_code = ptmstr1.pt_bom_code))
                           no-lock no-error.
                           l_nextptp = no.
                        end. /* ELSE IF L_NEXTPTP = NO */

                     end. /* IF NOT AVAILABLE PTP_DET */

                     if available ptmstr1 then do:
                        level = l_level.
                     end. /* IF AVAILABLE PTMSTR1 */

                  end. /* ELSE IF L_NEXT = NO */

                  bomloop1:
                  do while available ptmstr1:
                     l_next = no.
                     for first ps_mstr
                        fields(ps_comp ps_end ps_lt_off ps_par
                               ps_ps_code ps_qty_per ps_qty_per_b
                               ps_qty_type ps_ref ps_scrp_pct ps_start)
                        where ps_mstr.ps_comp = ptmstr1.pt_part
                        use-index ps_comp
                     no-lock : end.

                     if available ps_mstr then do:
                        comp = ptmstr1.pt_part.
                        leave bomloop1.
                     end. /* if available ps_mstr */

                     else if not available ps_mstr then do:

                        find next  ptp_det where ptp_det.ptp_bom_code = comp
                        no-lock no-error.

                        if available ptp_det then do:
                           find next ptmstr1 where ptmstr1.pt_part = ptp_part
                           no-lock no-error.
                        end. /* IF AVAIL PTP_DET */

                        else do:

                           find next ptmstr1 where ptmstr1.pt_bom_code = comp
                           no-lock no-error.

                           if not available ptmstr1 then do:

                              for first psmstr
                                 fields(ps_comp ps_end ps_lt_off ps_par
                                        ps_ps_code ps_qty_per ps_qty_per_b
                                        ps_qty_type ps_ref ps_scrp_pct
                                        ps_start)
                                 where recid(psmstr) = l_psrecid
                              no-lock: end.

                              find next ptmstr1
                                 where ptmstr1.pt_bom_code = psmstr.ps_par
                                 and   not(can-find (first ptp_det
                                 where ptp_part = ptmstr1.pt_part and
                                 ptp_bom_code = ptmstr1.pt_bom_code))
                              no-lock no-error.

                           end. /* IF NOT AVAILABLE PTMSTR1 */

                        end. /* ELSE DO */

                     end. /* IF NOT AVAIL PS_MSTR */

                  end. /* IF AVAILABLE PTMSTR BOMLOOP1 */

               end. /* NOT AVAIL PS_MSTR */

            end.

            else do:

               find next ps_mstr use-index ps_comp
                  where ps_mstr.ps_comp = comp
               no-lock no-error.

               /* IF THE PRODUCT STRUCTURE RECORD IS NOT AVAILABLE THEN THIS  */
               /* PROCEDURE EXPLODES FURTHER USING THE PTP_DET AND PT-MSTR    */
               /* BY VERIFYING IF THE COMPONENT EXISTS AS A BOM CODE FOR ANY  */
               /* OTHER ITEMS.                                                */
               if not available ps_mstr then do:

                  if l_next = yes then do:

                     for first ptp_det
                        fields(ptp_bom_code ptp_part)
                        where ptp_det.ptp_bom_code = comp
                     no-lock: end. /* FOR FIRST PTP_DET */

                     if available ptp_det then do:
                        l_nextptp = yes.
                        for first ptmstr1
                           fields(pt_bom_code pt_desc1 pt_desc2
                                  pt_iss_pol pt_part pt_phantom)
                           where  ptmstr1.pt_part = ptp_part
                        no-lock: end.
                     end. /* IF AVAILABLE PTP_DET */

                     else
                     for first ptmstr1
                        fields(pt_bom_code pt_desc1 pt_desc2
                               pt_iss_pol pt_part pt_phantom)
                        where ptmstr1.pt_bom_code = comp
                     no-lock: end.

                     for first psmstr
                        fields(ps_comp ps_end ps_lt_off ps_par
                               ps_ps_code ps_qty_per ps_qty_per_b
                               ps_qty_type ps_ref ps_scrp_pct ps_start)
                        where psmstr.ps_par = comp
                     no-lock: end.

                     if available psmstr then
                     assign
                        l_psrecid = recid(psmstr)
                        l_level   = level.

                  end. /* L_NEXT = YES */

                  else do:

                     for first psmstr
                        fields(ps_comp ps_end ps_lt_off ps_par
                               ps_ps_code ps_qty_per ps_qty_per_b
                               ps_qty_type ps_ref ps_scrp_pct ps_start)
                        where recid(psmstr) = l_psrecid
                     no-lock: end.

                     find next ptp_det
                        where ptp_det.ptp_bom_code = psmstr.ps_par
                     no-lock no-error.

                     if available ptp_det then do:
                        for first ptmstr1
                           fields(pt_bom_code pt_desc1 pt_desc2
                                  pt_iss_pol pt_part pt_phantom)
                           where ptmstr1.pt_part = ptp_part
                        no-lock: end.
                     end. /* IF AVAIL PTP_DET */

                     else do:

                        if l_nextptp = yes then do:
                           for first ptmstr1
                              fields(pt_bom_code pt_desc1 pt_desc2
                                     pt_iss_pol pt_part pt_phantom)
                              where ptmstr1.pt_bom_code = psmstr.ps_par
                           no-lock: end.
                           l_nextptp = no.
                        end. /* IF L_NEXTPTP = YES */

                        else do:
                           find next ptmstr1
                              where ptmstr1.pt_bom_code = psmstr.ps_par
                              and not(can-find (first ptp_det
                              where ptp_part = ptmstr1.pt_part and
                              ptp_bom_code = ptmstr1.pt_bom_code))
                           no-lock no-error.
                           l_nextptp = no.
                        end. /* ELSE IF L_NEXTPTP = NO */

                     end. /* IF NOT AVAILABLE PTP_DET */

                     if available ptmstr1 then do:
                        level = l_level.
                     end. /* IF AVAILABLE PTMSTR1 */

                  end. /* ELSE IF L_NEXT = NO */

                  bomloop1:
                  do while available ptmstr1:

                     l_next = no.

                     for first ps_mstr
                        fields(ps_comp ps_end ps_lt_off ps_par
                               ps_ps_code ps_qty_per ps_qty_per_b
                               ps_qty_type ps_ref ps_scrp_pct ps_start)
                        where ps_mstr.ps_comp = ptmstr1.pt_part
                        use-index ps_comp
                     no-lock: end.

                     if available ps_mstr then do:
                        comp = ptmstr1.pt_part.
                        leave bomloop1.
                     end. /* if available ps_mstr */

                     else if not available ps_mstr then do:

                        find next ptp_det where ptp_det.ptp_bom_code = comp
                        no-lock no-error.

                        if available ptp_det then do:
                           find next ptmstr1 where ptmstr1.pt_part = ptp_part
                           no-lock no-error.
                        end. /* IF AVAIL PTP_DET */

                        else do:

                           find next ptmstr1 where ptmstr1.pt_bom_code = comp
                           no-lock no-error.

                           if not available ptmstr1 then do:

                              for first psmstr
                                 fields(ps_comp ps_end ps_lt_off ps_par
                                        ps_ps_code ps_qty_per ps_qty_per_b
                                        ps_qty_type ps_ref ps_scrp_pct
                                        ps_start)
                                 where recid(psmstr) = l_psrecid
                              no-lock: end.

                              find next ptmstr1
                                 where ptmstr1.pt_bom_code = psmstr.ps_par
                                 and   not(can-find (first ptp_det
                                 where ptp_part = ptmstr1.pt_part and
                                 ptp_bom_code = ptmstr1.pt_bom_code))
                              no-lock no-error.

                           end. /* IF NOT AVAILABLE PTMSTR1 */

                        end. /* ELSE DO */

                     end. /* IF NOT AVAIL PS_MSTR */

                  end. /* IF AVAILABLE PTMSTR BOMLOOP1 */

               end. /* NOT AVAIL PS_MSTR */

            end.

         end.

         else do:
            find next ps_mstr use-index ps_comp
               where ps_mstr.ps_comp = comp
            no-lock no-error.
         end.

      end.

      
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

      if skpge then page.

      for first ps_mstr
         fields(ps_comp     ps_end     ps_lt_off    ps_par
                ps_ps_code  ps_qty_per ps_qty_per_b
                ps_qty_type ps_ref     ps_scrp_pct  ps_start)
         where ps_mstr.ps_comp > temp_comp
         and ps_mstr.ps_comp <= component2
      no-lock: end.

      assign
         l_next    = yes
         l_nextptp = no.

   end.

   /* REPORT TRAILER */
   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end.

{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" component1 component2 eff_date maxlevel skpge "} /*Drive the Report*/
